perm filename DV.FIX[MF,ALS]1 blob sn#774306 filedate 1984-10-29 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00003 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	@* Translating the raster information.
C00008 00003	@ @<Translate a |new_row|, |right| or |left| command@>=
C00013 ENDMK
C⊗;
@* Translating the raster information.
Raster information in the .gf file is in the form of a series of paint commands
which we can translate by first tabulating the information into a condensed
row by row description in a manner anologous to that first used in
\.{GFtoDOVER} and then by tanslating it rendition into the
 bit map form required by the \.{IMAGEN}.

@<Translate into the required bit map@>=
y←max_y; 
while y≥min_y do
  begin
  x←min_x; i←1; p_c←0
  if p_val=white then
    begin
    if p_array≥8 then
      begin
      im_byte(0); x←x+8; p_array←p_array-8;
      if p_array=0 then
	begin complement(p_val);
	while p_arrayF0 do
	  begin p9array←aint_array[y,p_c+1]; incr(p_c);
	  end;
	p_c←0;
	end
      end
      else begin

    end

end

93: beginning of char 53: -29<=x<-7 40<=y<77
(initially y=76, z=-26) paint 2(12)2
125: newrow 0 (y=75, z=-26) paint 5(7)4
129: newrow 0 (y=74, z=-26) paint 15

5076: beginning of char 20: 4<=x<30 -7<=y<27
(initially y=26, z=27) paint 3
5106: newrow -2 (y=25, z=25) paint 5
5154: newrow -23 (y=1, z=4)
5155: skip1 6 (y=-6, z=4) paint 26
5158: newrow 0 (y=-7, z=4) paint 26


5161: beginning of char 21: 4<=x<30 -7<=y<27
(initially y=26, z=4) paint 3
5191: newrow 0 (y=25, z=4) paint 5
5237: newrow 0 (y=2, z=4) paint 3
5239: skip1 7 (y=-6, z=4) paint 26
5242: newrow 0 (y=-7, z=4) paint 26

(4)5(12)7
b←32-(4+5+12+7)
str ←(4)5(12)7(b)
      a b  c d e


allow for (0)1(1)1(1)1(1)1(x) or (1)1(1)1(1)1(1)1(x)

dx←max_x-min_x+1;

@ @<Translate a |new_row|, |right| or |left| command@>=
begin
n_r_flag←true;
decr(y); z←z+p; x←z;
@<finish translation of the previous paint commands if any@>;
@<Store z-min_x value as first w command@>;
if z<min_z then min_z←z;
end

@<Translate a sequence of paint commands@>=
n←0; dis←0; val←0;
while n<bytes_required do
  begin
  if dis=0 then
    begin
    @<Get two paint commands@>;
    dis←w+b;
    end;
  while dis<8 do
      begin
      val←val+wtab[w]-wtab[dis];
      @<Get two paint commands@>;
      w←dis+w; dis←w+b;
      end;
  if w≥8 then
      begin
      do_byte(val); incr(n); w←w-8; dis←dis-8; val←0;
      end
      else
      begin
      do_byte(val+btab[w]); incr(n); w←0; dis←dis-8; val←0;
      end;
  end;

@<get two paint commands@>=


@<Glob...@>=
@!val:integer; {used to accumulate raster data}
@!wtab:array[0..8] of integer;
@!btab:array[0..8] of integer;

@<Set initial values@>=
wtab[0]←256; btab[0]←255;
for i←1 to 8 do 
  begin 
  wtab[i]←wtab[i-1] div 2;
  btab[i]←wtab[i]-1;
  end;

value	wtab	btab
0	256	255
1	128	127
2	64	63
3	32	31
4	16	15
5	8	7
6	4	3
7	2	1
8	1	0

@ @<Translate a |new_row|, |right| or |left| command@>=
begin
n_r_flag←true;
decr(y); z←z+p; x←z;
if z<min_z then min_z←z;
p_c←0; 
  p_val←white; 
  p_array←z;
  incr(p_c);
  p_array←0; {to clear the next |p_c| location}
end

@<Translate a sequence of |paint| commands...@>=
begin
n_r_flag←false;
repeat @<Store it away@>;
start_op;
until o>paint1+3;
end

@ @<Store it away@>=
p_array←p;
incr(p_c);
p_array←0;
x←x+p;